package com.tul.exercise.base.thread.base;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 *
 */
public class NaiveExceptionHandling {
    public static void main(String[] args) {
        // 将线程中可能抛出异常的代码放在try/catch中，没有效果，依然抛出到main线程
        try {
            ExecutorService exec = Executors.newCachedThreadPool();
            exec.execute(new ExceptionThread());

        } catch (RuntimeException e) {
            // 这里的代码不被执行
            System.out.println(e);
        }
    }
}
